﻿using System;
using System.Collections.Generic;
using Gameplay.PVE.Utils;
using UnityEngine;
using XLua;
using Yoozoo.Framework.Core;

namespace Gameplay.PVE.Survivor
{
    public class BattleHeroConfig
    {
        public int id;
        public string name;
        public int attack_id;
        public List<int> skill_id;
        public float move_speed;
        public int res_id;
        public int sound_bank;
        public List<int> passive_skill;
        public List<int> birth_element;
        
        //属性
        public int hp;
        public float critical_rate;
        //public int attack;
        //public int defence;

        public float searchRange;

        public int summon_id;

        public int attack;
        public int defence;

        public int is_boss;
        public int drop_basemoney;

        public  List<Vector2Int> bubble;

        public float hud_offset;

        public int is_full_body;

        public bool IsBossHud()
        {
            return (is_boss & (int)EBossFeature.Hud) > 0;
        }
        public bool IsBossWarning()
        {
            return (is_boss & (int)EBossFeature.Warning) > 0;
        }
        public bool IsBossFocus()
        {
            return (is_boss & (int)EBossFeature.Focus) > 0;
        }
    }
    
    public partial class BattleConfigManager
    {
        private Dictionary<int, BattleHeroConfig> heroConfigMap;
        public BattleHeroConfig GetHeroConfig(int id)
        {
            if (heroConfigMap.TryGetValue(id,out var config))
            {
                return config;
            }
            UnityEngine.Debug.LogError("英雄配置找不到" + id);
            return null;
        }
        public static void PreloadBattleHeroConfig(LuaTable table)
        {
            PveUtils.PreloadRpgConfig(table,ref Instance.heroConfigMap);
        }
    }
}
